#pragma once


#include <QtWidgets/QMainWindow>
#include "ui_detectpower.h"
#include <QSerialport>
#include <QByteArray>
#include <QTimer>
#include <QProcess>
#include <QIODevice>
#include <QDebug>
#include <QSerialPortInfo>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QComboBox>
#include <QPushButton>
#include <QLabel>
#include <QTcpSocket>
#include <QJsonObject>
#include <QJsonDocument>

class Detectpower : public QMainWindow {
	Q_OBJECT

public:
	Detectpower(QWidget* parent = nullptr);
	~Detectpower();
	void queryCapElect();
	void receiveData();

	void shutDownComputer();

	bool isConnect = 0;
	bool shutdownConfirm = 0;

	QStringList serialPortName;
	QList<quint32> serailBuadrate;
	QList<int> serialDatabits;
	QList<QString> serialStopbits;

	int lessPowerCount1 = 0;
	int lessPowerCount2 = 0;
private:
	Ui::detectpowerClass* ui;
	QSerialPort serialPort;
	QTimer* timer;
	QTimer* sendTimer;
	//QTimer* checkTimer;
	QSerialPortInfo* port;
	QTcpSocket* client;


public slots:
	void openCloseButton();

	void netDataReceived();

	void netConnect();

	void cmdAnother();

	//void checkShutdown();
};
